<?php
declare (strict_types = 1);

namespace app\model;

use think\Model;
use app\traits\MyModelTrait;

/**
 * @mixin \think\Model
 */
class User extends Model
{
    use MyModelTrait;

    // 会员表
    protected $table = 'user';

    /**
     * 生成记录
     *
     * @param string $account   账户
     * @param string $password  密码
     * @param string $salt      加密盐
     * @param string $nickname  昵称
     */
    public static function generateLog(string $account, string $password, string $salt = '', string $nickname = ''): void
    {
        $insert = [
            'account'       => $account,
            'password'      => $password,
            'salt'          => $salt,
            'nickname'      => $nickname,
            'is_lock'       => 0,
            'is_deleted'    => 0,
            'created_at'    => date('Y-m-d H:i:s'),
            'updated_at'    => date('Y-m-d H:i:s'),
        ];
        self::insert($insert);
    }// generateLog() end
}
